/*
 * MidiNunchukButton.cpp
 *
 *  Created on: 19/lug/2011
 *      Author: marcolembo
 */

#include "MidiNunchukButton.h"
#include "NunchukDriver.h"

namespace ml
{

    MidiNunchukButton::MidiNunchukButton(enNunchukButtonType _type,
                                         Driver* _drv)
        : MidiButton(_drv),
          m_type(_type)

    {
    }


    void MidiNunchukButton::SendMidiEvent()
    {
        //implementazione specifica per nunchuk
        NunchukDriver *nunchDriver = static_cast<NunchukDriver*>(m_driver);
        short dataToSend = 0;
        if(m_type == eZ)
        {
            if(nunchDriver->Is_Z_ButtonPressed())
                dataToSend = 1;
        }
        else if(m_type == eC)
        {
            if(nunchDriver->Is_C_ButtonPressed())
                dataToSend = 1;
        }
    }

    MidiNunchukButton::~MidiNunchukButton()
    {
    }

}
